﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SNSpirit.Service.Access;
using SNSpirit.Service.Identity;

namespace SNSpirit.Service.Authentication
{
    [Serializable]
    public abstract class AuthenticationToken
    {
        /// <summary>
        /// Is current token a anonymous token
        /// </summary>
        public bool IsAnonymous { get; protected set; }

        /// <summary>
        /// Friendly name (maybe a username or guid etc.)
        /// </summary>
        public string FriendlyName { get; protected set; }

        /// <summary>
        /// User identity
        /// May be null when IsAnonymous is true
        /// </summary>
        public Identity.Identity Identity { get; protected set; }

        /// <summary>
        /// Get specifiy accessor of this authentication token
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public abstract IAccessor GetAccessor<T>() where T : IAccessor;
    }
}